package com.yutel.multher.jas.server;

import java.util.Enumeration;
import java.util.Map;
import java.util.Properties;

public class DefaultActivator {

	public void start() {
		showSystemEnvironment();
		try {
			while (true) {
				Thread.sleep(1000);
				System.out.println("app running!");
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	public void stop() {
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	private void showSystemEnvironment() {
		// System Properties
		Properties sp = System.getProperties();
		Enumeration<?> names = sp.propertyNames();
		while (names.hasMoreElements()) {
			String k = (String) names.nextElement();
			System.out.println("System Properties: " + k + "="
					+ sp.getProperty(k));
		}

		// System Environment
		Map<String, String> env = System.getenv();
		for (String k : env.keySet()) {
			System.out.println("System Environment: " + k + "=" + env.get(k));
		}
	}

}
